<template>
    <div class="container">
        <div class="list" @click="selectMenu" data-id="1" :class="num==1?'active':''">
            <div class="list-child">
                <svg class="icon" aria-hidden="true" v-if="num==1">
                    <use xlink:href="#icon-icon-test6"></use>
                </svg>
                <svg class="icon" aria-hidden="true" v-if="num!=1">
                    <use xlink:href="#icon-icon-test"></use>
                </svg>
            </div>
            <div class="list-child1">
                首页
            </div>
        </div>
        <div class="list" @click="selectMenu" data-id="2" :class="num==2?'active':''">
            <div class="list-child">
                <svg class="icon" aria-hidden="true" v-if="num==2">
                    <use xlink:href="#icon-icon-test2"></use>
                </svg>
                <svg class="icon" aria-hidden="true" v-if="num!=2">
                    <use xlink:href="#icon-icon-test3"></use>
                </svg>
            </div>
            <div class="list-child1">
                会员卡
            </div>
        </div>
        <div class="list" @click="selectMenu" data-id="3" :class="num==3?'active':''">
            <div class="list-child">
                <svg class="icon" aria-hidden="true" v-if="num==3">
                    <use xlink:href="#icon-icon"></use>
                </svg>
                <svg class="icon" aria-hidden="true" v-if="num!=3">
                    <use xlink:href="#icon-icon-test1"></use>
                </svg>
            </div>
            <div class="list-child1">
                可用场景
            </div>
        </div>
        <div class="list" @click="selectMenu" data-id="4" :class="num==4?'active':''">
            <div class="list-child">
                <svg class="icon" aria-hidden="true" v-if="num==4">
                    <use xlink:href="#icon-icon-test5"></use>
                </svg>
                <svg class="icon" aria-hidden="true" v-if="num!=4">
                    <use xlink:href="#icon-icon-test4"></use>
                </svg>
            </div>
            <div class="list-child1">
                个人中心
            </div>
        </div>
    </div>
</template>

<script>
    export default {
        name: "foot",
        data(){
            return{
            }
        },
        methods:{
            selectMenu(e){
                let id = e.currentTarget.dataset.id;
                switch (id){
                    case '1':
                        this.$router.push('/');
                        break;
                    case '2':
                        this.$router.push('/my/card/0');
                        break;
                    case '3':
                        this.$router.push('/myscroll');
                        break;
                    case '4':
                        this.$router.push('/mine');
                        break;
                }
            },
        },
        props:{
            num:{
                type:Number,
            },
        },
    }
</script>

<style scoped>
    .container{
        width: 100%;
        height: 3rem;
        position: fixed;
        bottom: 0;
        left: 0;
        display: flex;
        justify-content: space-between;
        z-index: 90;
        background-color: white;
        border-top: 1px solid #eee;
    }
    .container > .list{
        width:25%;
        height:100%;
        line-height: 2rem;
        text-align: center;
        color: #666666;
    }
    .container > .list:focus{
        color:#56b176;
    }
    .container > .list > .list-child{
        height: 50%;
    }
    .container > .list > .list-child1{
        height: 50%;
        font-size: 0.7rem;
        line-height: 2rem;
    }
    .container > .list > .list-child > i{
        font-size: 1.5rem;
    }
    .active{
        color:#0050fe !important;
    }
    /*图标偏大的处理*/
</style>